/**
 * @author wys
 * created in 16:21 2019/2/28
 */

class SuperClass {
    private int n;

    SuperClass() {
        System.out.println("SuperClass");
    }

    SuperClass(int n) {
        System.out.println(" SuperClass(n):" + n);
        this.n = n;
    }

    /**
     * 非构造函数要有返回值
     */
    void SuperTest() {
        System.out.println("superTest");
    }

}

class SubClass extends SuperClass {
    private int n;

    /**
     * 使用这个无参数构造函数的时候
     * 自动调用父类的无参数构造器
     */
    SubClass() {
        System.out.println("SubClass");
        super.SuperTest();

    }


    SubClass(int n) {
        System.out.println("SubClass(n):" + n);
        this.n = n;
    }

}

class SubClass2 extends SuperClass {
    private int n;

    /**
     * 使用这个无参数构造函数的时候
     * 自动调用父类的无参数构造器
     */
    SubClass2() {
        System.out.println("SubClass2");
    }

    SubClass2(int n) {
        System.out.println("SubClass2(n):" + n);
        this.n = n;
    }

    void sub2Test() {
        System.out.println(" sub2Test ");
    }

}

public class TestSuperSub {

    public static void main(String args[]) {

        SubClass subClass = new SubClass();

        SubClass2 subClass2 = new SubClass2(100);

        new SubClass2();
        SubClass2 subClass21 = new SubClass2(200);
        subClass21.sub2Test();

    }


}
